#!/usr/bin/env python
#coding=utf-8
'''
Created on Aug 12, 2010

@author: lxd
'''
import threading
from common.web import Web
import re

class MD5Thread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

    def parseMD5(self, data):
        p = re.compile(r'<div id="md5">(?P<md5>[^<>].*?)</div>', re.IGNORECASE)
        m = re.search(p, data)
        if m:
            return m.group('md5')
        else:
            return None

    def run(self):
        web = Web(times=1)
        f = web.fetchData('', 'http://91webtools.appspot.com/yy')
        data = f.read()        
        md5 = self.parseMD5(data)
        if md5:
            pass
            
if __name__ == '__main__':
    md5Thread = MD5Thread()
    md5Thread.start()
